<%@page import="imoney.server.util.CookieBuilderServer"%>
<%@page import="imoney.shared.exception.NoSuchPersonException"%>
<%@page import="imoney.shared.exception.PositionOutOfDateException"%>
<%@page import="imoney.shared.Statics"%>
<%@page import="imoney.server.UserServlet"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>

<%@ page import="com.google.appengine.api.users.UserService"%>
<%@ page import="com.google.appengine.api.users.UserServiceFactory"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Account Creation Page</title>

</head>
<body>

	<%
		UserService userService = UserServiceFactory.getUserService();
		String userID = userService.getCurrentUser().getUserId();
		String pseudo = "Enter your pseudo";
		// try to find some account data from the cookie
		Cookie cookie = null;
		for (Cookie cook : request.getCookies()){
			if (cook.getName().equals(Statics.Cookie_INDEX_OF_PERSON)) {
				cookie = cook;
				break;
			}
		}
		if (cookie != null) {
			String storedID = CookieBuilderServer.readUserId(cookie);
			// verify cookie is corresponding to logged user
			if (storedID.equals(userID)) {
				pseudo = CookieBuilderServer.readPseudo(cookie);
			}
		}
	%>

	<h2>
		Details of
		<%=userService.getCurrentUser().getEmail()%>
		:
	</h2>

	<form name='profile' action='/imoney/account' method='post'>
		<label for='pseudo'>Pseudo : </label>
		<input type='text' value='<%=pseudo %>' name='pseudo' />
		<br /> <br />
		<input type='hidden' name='googleID' value='<%=userID%>' />
		<input type='submit' name='submit' value='Save' />
		<input type='button' value='Cancel' onClick="location.href='/auth/iMoney.html'" />
	</form>
	<br>

	<!-- location of the group module -->
	<div id='groups'></div>
</body>
</html>






















